Objects Reference

boudbox::ray_intersect

Prototype

int ray_intersect(vector& ro,vector& rd,float& tnear,float& tfar)

Parameters

Parameter Type Description
ro vector& ray origin
rd vector& ray direction
tnear float& returns near collision distance
tfar float& returns far collision distance

Return Value

Returns 0 if no collision is found, otherwise a collision was found.

Remarks

This method computes a ray intersection with the bounding box.
If a collision is found, the tnear and tfar parameters will be set to the distance from the ray origin where the ray intersected the bounding box.